(function() {

	var BusCon = require("../../core/bus/_con");
	var GoodsCon = require("../../core/goods/_con");
	var HotCon = require("../../core/hot/_con");
	var db = require("../../core/db/index");
	var config = require("../../core/_include/config");
	var ResponObj = require("../_include/responObj");

	module.exports = {
		prefix: "/hot",
		get: {
			//获取人气信息
			"/byId/:hot_id": function() {
				var hot_id = this.params.hot_id;
				var hot = HotCon.build(hot_id);
				this.body = ResponObj("json", hot.history_list.length);
			},
		},
		post: {
			"/add_hot/:hot_id": function() {
				var hot_id = this.params.hot_id;
				var history_info = {
					time_at: +new Date,
					flag: this.request.headers["user_ip"]
				};
				console.log("history_info:", history_info);
				var hot = HotCon.build(hot_id);
				hot.addHistory(history_info);
				this.body = ResponObj("json", hot.history_list.length);
			}
		}
	}
}());